| 
                
               | 
              
                
               | 
              
                @@ -10,19 +10,6 @@ from mch.models import BrandInfo, DistributorInfo, LatestAppInfo, ModelInfo, Ope 
               | 
            
            
            
              | 
                10
               | 
              
                10
               | 
              
                 from utils.error.errno_utils import OperatorStatusCode 
               | 
            
            
            
              | 
                11
               | 
              
                11
               | 
              
                  
               | 
            
            
            
              | 
                12
               | 
              
                12
               | 
              
                  
               | 
            
            
            
              | 
                13
               | 
              
                
               | 
              
                -def bmd_infos(operator): 
               | 
            
            
            
              | 
                14
               | 
              
                
               | 
              
                -    brands = BrandInfo.objects.filter(brand_id=operator.brand_id, status=True).order_by('position')
               | 
            
            
            
              | 
                15
               | 
              
                
               | 
              
                -    brands = [brand.data for brand in brands] 
               | 
            
            
            
              | 
                16
               | 
              
                
               | 
              
                - 
               | 
            
            
            
              | 
                17
               | 
              
                
               | 
              
                -    models = ModelInfo.objects.filter(brand_id=operator.brand_id, status=True).order_by('position')
               | 
            
            
            
              | 
                18
               | 
              
                
               | 
              
                -    models = [model.data for model in models] 
               | 
            
            
            
              | 
                19
               | 
              
                
               | 
              
                - 
               | 
            
            
            
              | 
                20
               | 
              
                
               | 
              
                -    distributors = DistributorInfo.objects.filter(brand_id=operator.brand_id, status=True).order_by('position')
               | 
            
            
            
              | 
                21
               | 
              
                
               | 
              
                -    distributors = [distributor.data for distributor in distributors] 
               | 
            
            
            
              | 
                22
               | 
              
                
               | 
              
                - 
               | 
            
            
            
              | 
                23
               | 
              
                
               | 
              
                -    return brands, models, distributors 
               | 
            
            
            
              | 
                24
               | 
              
                
               | 
              
                - 
               | 
            
            
            
              | 
                25
               | 
              
                
               | 
              
                - 
               | 
            
            
            
              | 
                26
               | 
              
                13
               | 
              
                 @logit 
               | 
            
            
            
              | 
                27
               | 
              
                14
               | 
              
                 def login_api(request): 
               | 
            
            
            
              | 
                28
               | 
              
                15
               | 
              
                     phone = request.POST.get('phone', '')
               | 
            
            
            
            
            
              | 
                
               | 
              
                
               | 
              
                @@ -39,13 +26,8 @@ def login_api(request): 
               | 
            
            
            
              | 
                39
               | 
              
                26
               | 
              
                     if not check_password(password, operator.encryption): 
               | 
            
            
            
              | 
                40
               | 
              
                27
               | 
              
                         return response(OperatorStatusCode.OPERATOR_PASSWORD_ERROR) 
               | 
            
            
            
              | 
                41
               | 
              
                28
               | 
              
                  
               | 
            
            
            
              | 
                42
               | 
              
                
               | 
              
                -    brands, models, distributors = bmd_infos(operator) 
               | 
            
            
            
              | 
                43
               | 
              
                
               | 
              
                - 
               | 
            
            
            
              | 
                44
               | 
              
                29
               | 
              
                     return response(200, data={
               | 
            
            
            
              | 
                45
               | 
              
                30
               | 
              
                         'optor_id': operator.operator_id, 
               | 
            
            
            
              | 
                46
               | 
              
                
               | 
              
                -        'brands': brands, 
               | 
            
            
            
              | 
                47
               | 
              
                
               | 
              
                -        'models': models, 
               | 
            
            
            
              | 
                48
               | 
              
                
               | 
              
                -        'distributors': distributors, 
               | 
            
            
            
              | 
                49
               | 
              
                31
               | 
              
                     }) 
               | 
            
            
            
              | 
                50
               | 
              
                32
               | 
              
                  
               | 
            
            
            
              | 
                51
               | 
              
                33
               | 
              
                  
               | 
            
            
            
            
            
              | 
                
               | 
              
                
               | 
              
                @@ -61,7 +43,14 @@ def bmd_infos(request): 
               | 
            
            
            
              | 
                61
               | 
              
                43
               | 
              
                     if operator.user_status == OperatorInfo.DISABLED: 
               | 
            
            
            
              | 
                62
               | 
              
                44
               | 
              
                         return response(OperatorStatusCode.OPERATOR_NOT_ACTIVATED) 
               | 
            
            
            
              | 
                63
               | 
              
                45
               | 
              
                  
               | 
            
            
            
              | 
                64
               | 
              
                
               | 
              
                -    brands, models, distributors = bmd_infos(operator) 
               | 
            
            
            
              | 
                
               | 
              
                46
               | 
              
                +    brands = BrandInfo.objects.filter(brand_id=operator.brand_id, status=True).order_by('position')
               | 
            
            
            
              | 
                
               | 
              
                47
               | 
              
                +    brands = [brand.data for brand in brands] 
               | 
            
            
            
              | 
                
               | 
              
                48
               | 
              
                + 
               | 
            
            
            
              | 
                
               | 
              
                49
               | 
              
                +    models = ModelInfo.objects.filter(brand_id=operator.brand_id, status=True).order_by('position')
               | 
            
            
            
              | 
                
               | 
              
                50
               | 
              
                +    models = [model.data for model in models] 
               | 
            
            
            
              | 
                
               | 
              
                51
               | 
              
                + 
               | 
            
            
            
              | 
                
               | 
              
                52
               | 
              
                +    distributors = DistributorInfo.objects.filter(brand_id=operator.brand_id, status=True).order_by('position')
               | 
            
            
            
              | 
                
               | 
              
                53
               | 
              
                +    distributors = [distributor.data for distributor in distributors] 
               | 
            
            
            
              | 
                65
               | 
              
                54
               | 
              
                  
               | 
            
            
            
              | 
                66
               | 
              
                55
               | 
              
                     return response(200, data={
               | 
            
            
            
              | 
                67
               | 
              
                56
               | 
              
                         'optor_id': operator.operator_id, 
               |